<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Account extends Model
{
    protected $fillable = ['disabled', 'available'];
    public $timestamps = false;

    //冻结
    public function disable($number)
    {
        $this->update([
            $this->disabled += $number,
            $this->available -= $number,
        ]);
    }

    //解冻
    public function enable($number)
    {
        $this->update([
            $this->disabled -= $number,
            $this->available += $number,
        ]);
    }
}